package com.lh.auth.controller;

import com.lh.auth.service.AuthService;
import com.lh.common.result.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName：AuthController
 * @Author: LeiHao
 * @Date: 2024/8/9 15:52
 * @Description: Auth控制层
 */
@RestController
@RequestMapping("auth")
@Log4j2
public class AuthController {
    @Autowired
    private HttpServletRequest request;
    @Autowired
    private AuthService authService;

    /* *
     * @Title: sendCode
     * @Author: DELL
     * @Date: 2024-08-09 15:56:24
     * @Params: [userPhone]
     * @Return: Result
     * @Description: 发送验证码
     */
    @PostMapping("sendCode/{userPhone}")
    public Result sendCode(@PathVariable String userPhone) {
        log.info("功能:发送验证码,功能URI:{},功能方法:{},功能参数:{}",
                request.getRequestURI(),request.getMethod(),userPhone);
        authService.sendCode(userPhone);
        log.info("功能:发送验证码,功能URI:{},功能方法:{},功能响应:{}",
                request.getRequestURI(),request.getMethod(),null);
        return Result.success();
    }
}

